package com.lxs;

import com.lxs.book.BookList;
import com.lxs.user.AdminUser;
import com.lxs.user.NormalUser;

import java.util.Scanner;

public class Main {

    //todo 程序启动入口 没有代码
    public static void main(String[] args) {
        BookList list=new BookList();
        System.out.println("请输入你的姓名:");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        System.out.println("欢迎"+name+"来到图书馆!");
        System.out.println("请输入你的身份(1.普通用户 2.管理员):");
        int num =scanner.nextInt();
        while (true){
            if (num==1){
                AdminUser user=new AdminUser(name);
                int menu = user.menu();
                user.doIOperation(menu,list);
                if (menu==0){
                    break;
                }
            }
            else if (num==2){
                NormalUser user=new NormalUser(name);
                int menu = user.menu();
                user.doIOperation(menu,list);
                if (menu==0){
                    break;
                }
            }
            else {
                break;
            }
        }
    }
}
